package com.gitee.feizns.explore.data_structure.array.easy;

import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author feizns
 * @since 2020/1/9
 */
public class FindDisappearedNumbers {

    public static void main(String[] args) {
        System.out.println(findDisappearedNumbers(new int[]{1, 1}));
    }

    public static List<Integer> findDisappearedNumbers(int[] num) {
        List<Integer> ret = new LinkedList<>();
        ret.add(null);
        for (int i = 1; i <= num.length; i++)
            ret.add(i);
        for (int i = 0; i < num.length; i++)
            ret.set(num[i], null);
        return ret.stream().filter(Objects::nonNull).collect(Collectors.toList());
    }

}
